package com.cswangdao.controller.admin;

import com.cswangdao.domain.vo.MarketMallVo;
import com.cswangdao.result.Result;
import com.cswangdao.service.MallConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RequestMapping("/admin/config/mall")
@RestController
@Slf4j
public class AdminConfigMallController {

    @Autowired
    private MallConfigService mallConfigService;

    /**
     * @description: 查询商场配置信息
     * @param: request, response
     * @return: void
     */
    @GetMapping
    public Result<MarketMallVo> doGet() {
        log.info("查询商场配置信息");
        MarketMallVo marketSystem = mallConfigService.getMarketMall();
        return Result.success(marketSystem);

    }

    /**
     * @description: 修改商场配置信息
     * @param: request, response
     * @return: void
     */
    @PostMapping
    public Result doPost(@RequestBody MarketMallVo marketMallVo) {
        log.info("修改商场配置信息");
        boolean flag = mallConfigService.updateMarkrtMall(marketMallVo);
        return flag ? Result.success() : Result.error("修改商场配置信息失败");

    }
}
